package com.hst.capacity.application.amqp;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 可抢订单生产者
 *
 * @author hans
 */
@Slf4j
@Component
public class GrabbingOrderSender {

    private final AmqpTemplate amqpTemplate;

    @Autowired
    private Queue lyQueue;

    public GrabbingOrderSender(AmqpTemplate amqpTemplate) {
        this.amqpTemplate = amqpTemplate;
    }

    /**
     * 发送消息到队列
     *
     * @param message 消息
     */
    public void send(String message) {
        amqpTemplate.convertAndSend(lyQueue.getName(), message);
    }


}
